package com.ruoyi.cmdb.service.impl;

import java.util.List;

import com.ruoyi.cmdb.util.GetId;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.cmdb.mapper.AuthMapper;
import com.ruoyi.cmdb.domain.Auth;
import com.ruoyi.cmdb.service.IAuthService;

/**
 * 认证Service业务层处理
 *
 * @author ruoyi
 * @date 2023-01-27
 */
@Service
public class AuthServiceImpl implements IAuthService
{
    GetId getId=new GetId();//用这个类的方法生成当前时间的id
    @Autowired
    private AuthMapper authMapper;

    /**
     * 查询认证
     *
     * @param id 认证主键
     * @return 认证
     */
    @Override
    public Auth selectAuthById(String id)
    {
        return authMapper.selectAuthById(id);
    }

    /**
     * 查询认证列表
     *
     * @param auth 认证
     * @return 认证
     */
    @Override
    public List<Auth> selectAuthList(Auth auth)
    {
        return authMapper.selectAuthList(auth);
    }

    /**
     * 新增认证
     *
     * @param auth 认证
     * @return 结果
     */
    @Override
    public int insertAuth(Auth auth)
    {
        auth.setId(getId.getTimeId());
        auth.setCreateTime(DateUtils.getNowDate());
        return authMapper.insertAuth(auth);
    }

    /**
     * 修改认证
     *
     * @param auth 认证
     * @return 结果
     */
    @Override
    public int updateAuth(Auth auth)
    {
        auth.setUpdateTime(DateUtils.getNowDate());
        return authMapper.updateAuth(auth);
    }

    /**
     * 批量删除认证
     *
     * @param ids 需要删除的认证主键
     * @return 结果
     */
    @Override
    public int deleteAuthByIds(String[] ids)
    {
        return authMapper.deleteAuthByIds(ids);
    }

    /**
     * 删除认证信息
     *
     * @param id 认证主键
     * @return 结果
     */
    @Override
    public int deleteAuthById(String id)
    {
        return authMapper.deleteAuthById(id);
    }
}
